using System;
using System.Linq.Expressions;
using ilgolosone.DomainModel.Entities;
using ilgolosone.Shared.Domain;

namespace ilgolosone.DomainModel.Queries
{
    public sealed class FindSpecialtyByName : IDomainQuery<Specialty>
    {
        private readonly string _name;

        public FindSpecialtyByName(string name)
        {
            _name = name;
        }

        public Expression<Func<Specialty, bool>> Criteria
        {
            get { return specialty => specialty.Name.Equals(_name); }
        }
    }

    public sealed class FindSpecialtyByPartOfName : IDomainQuery<Specialty>
    {
        private readonly string _partOfName;

        public FindSpecialtyByPartOfName(string partOfName)
        {
            _partOfName = partOfName;
        }

        public Expression<Func<Specialty, bool>> Criteria
        {
            get { return specialty => specialty.Name.Contains(_partOfName); }
        }
    }
}